<?php
namespace App\Libs\Captcha\Algorithms;
class Character extends \App\Libs\Base\Singleton implements AlgorithmInterface
{
    private $table = '0123456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVW';
    public function generate($length = 6) {
        $res = array();
        $total = strlen($this->table) - 1;
        for ($i = 0; $i < $length; $i ++) {
            $res[] = $this->table{mt_rand(0, $total)};
        }
        $res = join('', $res);
        return array('captcha' => $res, 'check' => strtolower($res));

    }   
}
